<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%
	StringBuffer strURL = request.getRequestURL();
	String URL = strURL.toString();
	String contPath = request.getContextPath();
	int nIndex = URL.indexOf(contPath);
	URL = "http://tugo.cn/weixin_aef/";
	%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport"
	content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection"
	content="telephone=no,email=no,date=no,address=no">
<title>阿尔发微信</title>
<link rel="stylesheet" type="text/css" href="../css/aui.css" />
<link rel="stylesheet" href="../css/icon.css" />
<link rel="stylesheet" href="../css/dialog.css" />
<link rel="stylesheet" href="../css/dialog-sally.css" />
<script type="text/javascript" src="../js/jquery-2.1.1.min.js"></script>
<style>
.aui-list-item-label-icon {
	color: #04be02 !important;
}

.aui-list-item-a {
	display: inline-flex;
	width: 100%;
	color: #000000;
}
.dialog__content {
	padding: 1.5rem 0;
}

.dialog__content>div {
	margin: 0 0 .5rem 0;
}

.icon-chenggong {
	color: #04be02 !important;
	font-size: 4rem;
}
.icon-shibai {
	color: #dc143c !important;
	font-size: 4rem;
}
.action {
	/*background-color: #03a9f4!important;*/
	border: none;
	color: #000000;
	margin-top: 1.5rem;
}
.layui-layer-btn0{
background-color:  #04be02 !important;
}
.showerror{
display: none;
text-align: center;
}
</style>
<script type="text/javascript" src="<%=URL%>js/cookies.js?version=1.1"></script>
<script type="text/javascript" src="<%=URL%>newedition/js/base.js?version=3.8"></script>
</head>
<body>
<input type=hidden name=contextPath
		value=<%= request.getContextPath()%> id="requestpath">
	<script type="text/javascript">
$(function(){
	clearCookieAll()
	     var openid="${openid}";    
	     setcookie("openid", openid, 30, "/");
	var json = {"openid": ""+openid+""}
	$.ajax({
		cache: false,
		type: "post",
		dataType:"json",/*加上datatype*/
		data: JSON.stringify(json),
		contentType: 'application/json;charset=UTF-8',
		url: ''+httpipstr+'alfa-mobile-ws/rest/OpenId/GetSingleOpenId',
		success: function(data) {
			 setcookie("openid",openid,30,"/");
			if(data.message=="1"){
				if(data.data.mobiletoken==""||data.data.mobiletoken==null){
					clearsalesmanCookieWithIdAll()
					clearuserCookieWithIdAll()
					location.href = "<%=URL%>salesman/newhtml/oiler_login.jsp" 
				}else{
					if(data.data.roleId=="10"){
						clearsalesmanCookieWithIdAll()
						setcookie("roleId", data.data.roleId, 30, "/");
						setcookie("mobiletokenuser", data.data.mobiletoken, 30, "/");
						setcookie("username", data.data.mobile, 300, "/");
						setcookie("useriphone", data.data.mobile, 300, "/");
						setcookie("realname", data.data.realname, 300, "/");
						setcookie("orgname", data.data.orgname, 300, "/");
						setcookie("userid", data.data.sysuserid, 300, "/");
						setcookie("address", data.data.address, 300, "/");
						location.href = "<%=URL%>salesman/newhtml/oiler_login.jsp" 
					}else if(data.data.roleId=="9"){
						clearuserCookieWithIdAll()
						setcookie("salesmanid", data.data.sysuserid, 300, "/");
						setcookie("mobiletokensalesman", data.data.mobiletoken, 300, "/");
						setcookie("username", data.data.username, 300, "/");
						setcookie("salesmaniphone", data.data.mobile, 300, "/");
						setcookie("roleId", data.data.roleId, 30, "/")
						location.href = "<%=URL%>salesman/newhtml/oiler_taskList.jsp" 
					}
				}
				
			}else{
				$.ajax({
					cache: false,
					type: "post",
					dataType:"json",/*加上datatype*/
					data: JSON.stringify(json),
					contentType: 'application/json;charset=UTF-8',
					url: 'http://tugo.cn/weixin_aef/recycle/addopenidinfo',
					success: function(data) {
						if(data.code=="0"){
							location.href = "<%=URL%>salesman/newhtml/oiler_login.jsp" 
						}
					}
				})
			}
			
		}
	});
	     
	     
	<%-- GetSingleOpenId(getCookie("openid")) 
	if(getCookie("mobiletokensalesman")==""){
		location.href="<%=URL%>salesman/newhtml/oiler_login.jsp"
	}
	else{
		location.href="<%=URL%>salesman/newhtml/oiler_taskList.jsp"
	} --%>
})

</script>
	</body>
</body>
</html>